<?php 

//1.创建头部
header('Content-type: image/png');

//2.创建画布，宽高，不用单位
$code = imageCreateTrueColor(100,50);

//3.设置背景颜色
$color = imageColorAllocate($code,200,255,255);

imagefill($code, 0, 0, $color);

//4.写字
//设置字体颜色
$color = imageColorAllocate($code,mt_rand(0,200),mt_rand(0,200),mt_rand(0,200));

//种子
$str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklnmopqrstuvwxyz";

for ($i=0; $i <4 ; $i++) { 

	$x =$i*20;
	$x +=10;
	$y = mt_rand(30,40);
	$OneStr =$str[rand(0,strlen($str))];
	imagettftext($code,mt_rand(20,25), mt_rand(-30,30) , $x , $y , $color, "./JandaQuirkygirl.ttf", $OneStr);
}

//增加一些线

for ($i=0; $i <0 ; $i++) { 
	$color = imageColorAllocate($code,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));

	imageline ( $code,mt_rand(5,90),mt_rand(5,50),mt_rand(5,90),mt_rand(5,50),$color);
}

//增加圆点

for ($i=0; $i <0 ; $i++) { 
	$color = imageColorAllocate($code,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));

	imageellipse ( $code ,mt_rand(2,98), mt_rand(2,48), 1 , 1 ,$color );
}

//5.输出图像
imagepng($code); 
//6.销毁资源
imageDestroy($code);

 ?>